package com.da.javatest.leetCode2;

public class Code925 {
    public boolean isLongPressedName(String name, String typed) {
        int index = 0;
        char[] chars = typed.toCharArray();
        for (char c : name.toCharArray()) {
            if (index == chars.length) {
                return false;
            }
            for (int i = index; i < chars.length; i++) {
                index++;
                if (c == chars[i]) {
                    break;
                }
            }
        }
        return name.charAt(name.length() - 1) == chars[chars.length - 1];
    }
}
